package com.itheima.mapper;


import com.itheima.pojo.Clazz;
import com.itheima.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface ClazzMapper {

    //@Select("select c.*, e.name masterName from clazz c left join emp e on c.master_id = e.id")
    public List<Clazz> list(EmpQueryParam empQueryParam);

    @Delete("delete from clazz where id = #{id}")
    public void deleteById(Integer id);

    @Insert("Insert into clazz (name, room, begin_date, end_date, master_id, subject, create_time, update_time) values (#{name}, #{room}, #{beginDate}, #{endDate}, #{masterId}, #{subject}, #{createTime}, #{updateTime})")
    public void addClazz(Clazz clazz);

    @Select("select * from clazz where id = #{id}")
    public Clazz getInfo(Integer id);

    //@Update("update clazz set name = #{name}, room = #{room}, begin_date = #{beginDate}, end_date = #{endDate}, master_id = #{masterId}, subject = #{subject}, update_time = #{updateTime}")
    public void update(Clazz clazz);

    @Select("select * from clazz")
    public ArrayList<Clazz> getAllClazz();
}
